﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Easycmd
{
    public enum ConfirmResult { Yes,No,YesToAll,NoToAll,Null};
    public partial class FileOverwriteConfirmDlg : Form
    {
        public FileOverwriteConfirmDlg()
        {
            InitializeComponent();
        }

        private void FileOverwriteConfirmDlg_Load(object sender, EventArgs e)
        {
            
            btnYes.Text = "yes";
            btnNo.Text = "no";
            bntYesToAll.Text = "yes to all";
            btnNoToAll.Text = "no to all";
            btnYes.Click += new EventHandler(btnYes_Click);
            btnNo.Click += new EventHandler(btnNo_Click);
            bntYesToAll.Click += new EventHandler(bntYesToAll_Click);
            btnNoToAll.Click += new EventHandler(btnNoToAll_Click);
        }

        void btnNoToAll_Click(object sender, EventArgs e)
        {
            result = ConfirmResult.NoToAll;
            Close();
        }

        void bntYesToAll_Click(object sender, EventArgs e)
        {
            result = ConfirmResult.YesToAll;
            Close();
        }

        void btnNo_Click(object sender, EventArgs e)
        {
            result = ConfirmResult.No;
            Close();
        }

        void btnYes_Click(object sender, EventArgs e)
        {
            result = ConfirmResult.Yes;
            Close();
        }
        ConfirmResult result = ConfirmResult.NoToAll;
        public static ConfirmResult Show(string text, string caption)
        {
            FileOverwriteConfirmDlg dlg = new FileOverwriteConfirmDlg();
            dlg.label1.Text = text;
            dlg.Text = caption;
            dlg.ShowDialog();
            return dlg.result;
        }
    }
}
